Skip to content

Call page.goto in e2e test with waitUntil: commit better offline support#6207

Merged
zoldar merged 1 commit intomasterfrom
playwright-make-goto-less-reliant-on-network
Mar 30, 2026
Merged

Call page.goto in e2e test with waitUntil: commit better offline support#6207
zoldar merged 1 commit intomasterfrom
playwright-make-goto-less-reliant-on-network

Conversation

@zoldar
Copy link
Copy Markdown
Contributor

@zoldar zoldar commented Mar 29, 2026

Currently, when running E2E tests without internet connection, each page.goto call takes several seconds, close to 10. This in turn makes basically all tests fail. With waitUntil option set to commit, we wait only until the page HTML starts loading. The default option value is load, which waits until all resources load. In practice however, given the tests are written according to guidelines (using playwright actions like click(), checking for visibility of expected elements with toBeVisible() etc.), we do not have to wait until the page's resources are fully loaded. The most likely reason for the slowdown are attempts to load gravatar images, which eventually time out.

After the change, the tests complete when offline, although they are still noticeably slower (~23 seconds vs ~38 seconds). Yet still, being able to run them offline at all is still in improvement.

Another benefit is that with the option added, even when the tests are run online, they execute faster (~18 seconds vs ~23 seconds).

Refs https://www.checklyhq.com/blog/why-page-goto-is-slowing-down-your-playwright-test/

Changes

Please describe the changes made in the pull request here.

Below you'll find a checklist. For each item on the list, check one option and delete the other.

Tests

  • Automated tests have been added

@zoldar zoldar requested a review from a team March 29, 2026 12:42
@zoldar zoldar added this pull request to the merge queue Mar 30, 2026
Merged via the queue into master with commit 7fddf70 Mar 30, 2026
23 checks passed
@zoldar zoldar deleted the playwright-make-goto-less-reliant-on-network branch March 30, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants